<div class="filter">
    <div class="f f0 item">
        <select data-am-selected>
            <option value="0" selected>当前群</option>
            <option value="1">所有群</option>
        </select>
    </div>

    <div class="f1 item" style="width: 80px;">
        <input type="text" class="am-form-field" placeholder="起始日期" id="start"
            data-am-datepicker="{theme:'success'}" readonly required />
    </div>
    <div class="f2 item" style="width: 80px;">
        <input type="text" class="am-form-field" placeholder="结束日期" id="end"
            data-am-datepicker="{theme:'success'}" readonly required />
    </div>
    <div class="f3 item" style="width: 110px;">
        <input type="text" class="am-form-field" placeholder="投注IP" />
    </div>
    <div class="f7 item" style="width: 110px;">
        <input type="text" class="am-form-field" placeholder="手机号" />
    </div>

    <div class="f4 item">
        <select data-am-selected>
            <option value="-1" selected>所有状态</option>
            <option value="0">未结算</option>
            <option value="1">已结算</option>
            <option value="2">撤单</option>
            <option value="3">重开奖</option>
        </select>
    </div>

    <div class="f5 item" style="width: 100px;">
        <input type="text" class="am-form-field" placeholder="起始期数" />
    </div>
    <div class="f6 item" style="width: 100px;">
        <input type="text" class="am-form-field" placeholder="结束期数" />
    </div>

    <div class="f7 item">
        <button type="button" class="am-btn am-btn-primary">查看</button>
    </div>
</div>

<table class="am-table am-table-bordered am-table-striped am-table-compact" id="result-table">
  <thead>
  <tr>
    <th width="110px">投注时间</th>
    <th width="110px">结算时间</th>
    <th>彩种/期数</th>
    <th>用户</th>
    <th width="100px">IP</th>
    <th>明细</th>
    <th>投注</th>
    <th>结果</th>
  </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<div class="zxf_pagediv"></div>
<style type="text/css">
    #result-table td {
        line-height: 20px;
        vertical-align: middle;
    }
</style>

<script src="../public/all/js/page_list.js"></script>
<script>
    Util.queryTemplate($("#result-table tbody"), ".zxf_pagediv", $(".f7 button"), function(page, size, cb) {
        if (!GroupUtil.group) return;
        var data = {
            pageNum: page,
            pageSize: size,
        };
        var v = $(".f1 input").val();
        if (v) data.start = v;
        var v = $(".f2 input").val();
        if (v) data.end = v;

        var v = $(".f3 input").val();
        if (v) data.ip = v;
        var v = $(".f4 select").val();
        if (v != '-1') data.state = v;

        var v = $(".f7 input").val().trim();
        if (v) data.uid = v;

        var v = $(".f5 input").val();
        if (v) data.startIssue = v;
        var v = $(".f6 input").val();
        if (v) data.endIssue = v;

        var lottery, groupid;
        if ($(".f0 select").val() == '0') {
            lottery = GroupUtil.group.lottery;
            groupid = GroupUtil.group.id;
        }
        startLoading();
        CMD.gquery_bet(lottery, groupid, data, function(list) {
            stopLoading();
            cb(list);
        });
    }, function(table, list, sum) {
        for (var i in list) {
            var tr = $("<tr></tr>");
            var target = Util.convertTarget(list[i].type, list[i].target);
            tr.append("<td>" + Util.converServerTime(list[i].time) + "</td>");
            tr.append("<td>" + Util.converServerTime(list[i].complete) + "</td>");
            tr.append("<td>" + get_game_display_name(list[i].type) + " 第" + list[i].issue + "期</td>");
            tr.append("<td>" + (list[i].user.nick || list[i].user.mobile) + "</td>");
            tr.append("<td>" + list[i].ip + "</td>");
            tr.append("<td>" + target + "@" + list[i].rate + "</td>");
            tr.append("<td>" + (list[i].amount/100) + "</td>");

            if (list[i].profit > 0)
                tr.append("<td class='red'>" + (list[i].profit/100) + "</td>");
            else
                tr.append("<td class='green'>" + (list[i].profit/100) + "</td>");

            table.append(tr);
        }
    });
</script>
   